﻿using System;
using System.Collections.Generic;
using System.Text;


namespace Snooze.Model
{
    using Castle.ActiveRecord;
    using Castle.ActiveRecord.Framework.Config;
    using System.Collections;


    public static class Repository<T> 
    {
        public static void Initialize(string map_path)
        {
            Init.Instance.Initialize(map_path);
        }

        public static T[] FindAll ()
        {
            if (!Init.Instance.Initialized) throw new Exception("Please initialise the Repository first.");
            return ActiveRecordBase<T>.FindAll();
        }

        public static T FindById(int id)
        {
            if (!Init.Instance.Initialized) throw new Exception("Please initialise the Repository first.");
            return ActiveRecordBase<T>.Find(id);
        }
    }
}
